package com.mstar.qs.basic.service;

import com.mstar.qs.common.bean.CommonCompositeMarket;
import com.mstar.qs.common.jdbc.MarketAndRegionFactory;
import com.mstar.qs.common.json.JsonObject;

/**
 * @deprecated please use CommonCompositeMarket instead
 * @author dchen2
 *
 */
@Deprecated
public class BasicInfoService {

	private static final CommonCompositeMarket ccm=MarketAndRegionFactory.buildCompositeMarket();
	
	private static BasicInfoService instance=new BasicInfoService();
	
	private BasicInfoService(){
	}
	
	public static BasicInfoService getInstance(){
		if(instance==null){
			instance = new BasicInfoService();
		}
		return instance;
	}
	
	/**
	 * Get map between exchange id and short name
	 * @return
	 */
	public String getExchShortName() {
		return new JsonObject(ccm.mapOfExchAndShortname()).toString();
	}
	
	
	/**
	 * Get Map between miccode and short name
	 * @return
	 */
	public String getMicCodeName() {
		return new JsonObject(ccm.mapOfMiccodeAndshortname()).toJson();
	}
	
	/**
	 * Get fixed map between exchange id and short name or miccode
	 * @return
	 */
	public String getMicCodeNameForJson() {
		return new JsonObject(ccm.mapOfExchAndShortnameMiccode()).toJson();
	}
	
	/*
	public String getExchangeMarketTime(){
		List<ExcShortName> list = dao.findAll();
		JSONObject returnObj = new JSONObject();
		if(list!=null && list.size()>0){
			try {
				for(ExcShortName esn : list){
					JSONArray jaTime = new JSONArray();
					jaTime.put(esn.getOpeningTime());
					jaTime.put(esn.getClosingTime());
					returnObj.put(String.valueOf(esn.getExcId()), jaTime);
				}
			} 	catch (JSONException e) {
				e.printStackTrace();
			}
		}
		return returnObj.toString();
	}
	
	*/
}
